package fastcsv; 

public class TimeSpan {

	private long startTime;
	private long endTime;
	public String title;

	public TimeSpan() {
	}

	public void start(){
		start("test start");
	}
	
	public void start(String s) {
		title = s;
		startTime = System.nanoTime();
	}

	public double stop() {
		endTime = System.nanoTime();
		return getMillisencond();
	}

	public void setStart() {
		startTime = System.nanoTime();
	}

	public void setEnd() {
		endTime = System.nanoTime();// System.currentTimeMillis();
	}

	public double getDay() {
		return (endTime - startTime) / 1000 / 1000 / 1000 / 60 / 24;
	}

	public double getHour() {
		return (endTime - startTime) / 1000 / 1000 / 1000 / 60 / 60;
	}

	public double getMinute() {
		return (endTime - startTime) / 1000 / 1000 / 1000 / 60;
	}

	public double getSecond() {
		return (endTime - startTime) / 1000 / 1000 / 1000;
	}

	public double getMillisencond() {
		return (endTime - startTime) / 1000 / 1000;
	}

	public double getMicrosencond() {
		return (endTime - startTime) / 1000;
	}

	public double getNanosencond() {
		return (endTime - startTime);
	}

	public String toString() {
		return title + ":" + getMillisencond() + " ms";
	}

}
